package main;



import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author ADMIN
 */
public class ketnoi {
    Connection con=null;

    public ketnoi() {
    }
    public Connection connect(){
        try {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); 
            con = DriverManager.getConnection("jdbc:sqlserver://localhost;"
                        + "databaseName = MSB;User = sa;Password = 123456");
        } catch (SQLException ex) {
            Logger.getLogger(ketnoi.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(ketnoi.class.getName()).log(Level.SEVERE, null, ex);
        }
        return con;
    }
    
}
